<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<div class="pageContent">
	<form method="post" id="activityForm" action="${rootUrl}/info/activity/${activity.id}" class="pageForm required-validate" onsubmit="return beforeSubmit(this);">
		<c:if test="${activity.id != 0 && activity.id != '' }"><input type="hidden" name="_method" value="put"></c:if>
		<input type="hidden" name="activity.id" value="${activity.id }">
		<div class="pageFormContent" layoutH="56">
			<p>
				<label>活动名称：</label>
				<input  name="activity.name" type="text" class="required" size="30" value="${activity.name}"/>
			</p>
			<p>
				<label>活动类型：</label>
				<select id="activityType" name="activity.type" onchange="activityTypeSelectChange()">
				<option <c:if test="${activity.type == 10}">selected="selected"</c:if> value="10">满送商品</option>
				<option <c:if test="${activity.type == 20}">selected="selected"</c:if> value="20">满减金额</option>
				</select>
			</p>
			<p>
				<label>订单限额：</label>
				<input name="theLimitMoney" class="required digits"  type="text" size="30" value="<fmt:formatNumber value="${activity.limitMoney/100}" pattern="0"/>" onfocus="if (value =='0'){value =''}"  
            		onblur="if (value ==''){value='0'}"/> 
			</p>
			 <p class="nowrap"> 
			    <label>满送商品</label>
			  	<input name="goodsSku.id" type="hidden" value="${activity.skuId}"/>
			  	<input name="goodsSku.name" type="text" readonly="readonly" size="180" value="${activity.skuName}"/>
			  	<a id="goodsSkuActivityId" class="btnLook" onclick="goodsSkuChoose()" lookupGroup="goodsSku" height="720" width="1000">商品sku</a>
		    </p> 
			<p>
			  <label>满减金额:</label>
			  <input name="theDiscountMoney" class="digits" type="text" size="30" value="<fmt:formatNumber value="${activity.discountMoney/100}" pattern="0"/>" onfocus="if (value =='0'){value =''}"  
            		onblur="if (value ==''){value='0'}"/>
			</p>
			<p>
				<label>活动状态：</label>
				<select  name="activity.state">
				<option <c:if test="${activity.state == 1}">selected="selected"</c:if> value="1">有效</option>
				<option <c:if test="${activity.state == 0}">selected="selected"</c:if> value="0">无效</option>
				</select>
			</p>
			<p>
				<label>排序：</label>
				<input  name="activity.sort" type="text" size="30" value="${activity.sort }" />
			</p>
			<p>
				<label>开始时间：</label>
				<input type="text" name="activity.startDate" class="required date" readonly="readonly" size="30" dateFmt="yyyy-MM-dd HH:mm:ss" value="<fmt:formatDate value="${activity.startDate}" pattern="yyyy-MM-dd HH:mm:ss"/>" /><a class="inputDateButton" href="javascript:;">选择</a>
			</p>
			<p>
				<label>结束时间：</label>
				<input type="text" name="activity.endDate" class="required date" readonly="readonly" size="30" dateFmt="yyyy-MM-dd HH:mm:ss" value="<fmt:formatDate value="${activity.endDate}" pattern="yyyy-MM-dd HH:mm:ss"/>" /><a class="inputDateButton" href="javascript:;">选择</a>
			</p>
			<dl class="nowrap">
				<dt>说明：</dt>
				<dd><textarea name="activity.description" cols="153" rows="5">${activity.description}</textarea></dd>
			</dl>
   		 </div>
    	<div class="formBar">
			<ul>
				<li><div class="buttonActive"><div class="buttonContent"><button id="theSubmit" type="submit">保存</button></div></div></li>
				<li>
					<div class="button"><div class="buttonContent"><button type="button" class="close">取消</button></div></div>
				</li>
			</ul>
		</div>
    </form>
    	
</div>
<script>
function goodsSkuChoose(){
	$("#goodsSkuActivityId").attr("href","${rootUrl}/goods/goods-sku/1/multipleDialog?multipleDialogMyIds="+$("input[name='goodsSku.id']").val()+"&multipleDialogMyNames="+$("input[name='goodsSku.name']").val());
}
function beforeSubmit(obj){
	$("input[name='goodsSku.id']").attr("name","activity.skuId");
	$("input[name='goodsSku.name']").attr("name","activity.skuName");
	return validateCallback(obj, editDialogAjaxDone);
}

</script>